document.getElementById('fetch-button').addEventListener('click', async () => {
        const url = document.getElementById('url-input').value;
        if (!url) {
            alert('请输入有效的URL');
            return;
        }
        try {
            const response = await fetch('/crawl?url=' + url);
            const data = await response.json();
            if (data.error) {
                alert(data.error);
            } else {
                document.querySelector('.name').textContent = data.name;
                document.querySelector('.header-right p.contact').textContent = data.contact;
                document.querySelector('.practice-experience').textContent = data.work_experience;
                document.querySelector('.education-background').textContent = data.education;
            }
        } catch (error) {
            alert('发生错误: ' + error.message);
        }
    });
